﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MsTestUtilities.RowTests;

namespace MsTestUtilitiesTests.RowTests
{
    [TestClass]
    public class SetupTests
    {
        private int _setups;

        [TestInitialize]
        public void Setup()
        {
            _setups = 0;
        }

        [TestMethod]
        public void MultipleTestRows_SetupIsCalledForEachRow()
        {
            new TestScenarioBuilder<int, int>()
                .WithSetup(RowSetup)
                .For(i => i)                
                .Given(2).Expect(g => _setups == 1).Fact
                .Given(2).Expect(g => _setups == 2).Fact
                .Given(2).Expect(g => _setups == 3).Fact
                .Evaluate();
        }

        private void RowSetup()
        {
            _setups++;
        }
    }
}
